* lisp.h (Lisp_Overlay): New tag.
authorJim Blandy <jimb@redhat.com>
Fri, 14 May 1993 14:41:36 +0000 (14:41 +0000)
committerJim Blandy <jimb@redhat.com>
Fri, 14 May 1993 14:41:36 +0000 (14:41 +0000)
(OVERLAYP): New predicate.
(CHECK_OVERLAY): New type-checker.
(Qoverlayp): New extern declaration.
* buffer.c (Foverlayp): New function.
(Qoverlayp): New atom.
(overlays_at, recenter_overlay_lists): Abort if we encounter an
invalid overlay.
(syms_of_buffer): defsubr Soverlayp; initialize Qoverlayp.
(Fdelete_overlay): Set the overlay's markers to point nowhere.
Use CHECK_OVERLAY instead of signalling a special error.
(Fmove_overlay, Foverlay_put): Use CHECK_OVERLAY instead of
signalling a special error.
(Foverlay_get): Use CHECK_OVERLAY.
* fns.c (internal_equal): Define this for overlays.
* buffer.h (OVERLAY_VALID): Define in terms of OVERLAYP.
* print.c (print): Give overlays their own print syntax.
* alloc.c (mark_object): Treat overlays like conses.

* lisp.h (FLOATP): Define this appropriately when LISP_FLOAT_TYPE
is not defined.

src/lisp.h

index 7d69e765695878672b0032077893b526beaff0f1..a13db81a776eab5ef084eadbf23075d5f8e786e7 100644 (file)
@@ -153,12 +153,19 @@ enum Lisp_Type
     Lisp_Window,
 
     /* Used by save,set,restore-window-configuration */
-    Lisp_Window_Configuration
+    Lisp_Window_Configuration,
 
 #ifdef LISP_FLOAT_TYPE
-      ,
-    Lisp_Float
+    Lisp_Float,
 #endif /* LISP_FLOAT_TYPE */
+
+    /* The overlay type.
+       An overlay values is actually a retagged cons, the first in a
+       list of the form
+           ((START . END) nil . PLIST)
+       where START and END are markers in the overlay's buffer, and
+       PLIST is the overlay's property list.  */
+    Lisp_Overlay
   };
 
 #ifndef NO_UNION_TYPE
@@ -626,7 +633,12 @@ typedef unsigned char UCHAR;
 #define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
 #define WINDOWP(x) (XTYPE ((x)) == Lisp_Window)
 #define WINDOW_CONFIGURATIONP(x) (XTYPE ((x)) == Lisp_Window_Configuration)
+#ifdef LISP_FLOAT_TYPE
 #define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
+#else
+#define FLOATP(x) (0)
+#endif
+#define OVERLAYP(x) (XTYPE ((x)) == Lisp_Overlay)
 
 #define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
 #define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
@@ -713,6 +725,9 @@ typedef unsigned char UCHAR;
 #define XFLOATINT(n) XINT((n))
 #endif /* LISP_FLOAT_TYPE */
 
+#define CHECK_OVERLAY(x, i) \
+  { if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));}
+
 /* Cast pointers to this type to compare them.  Some machines want int.  */
 #ifndef PNTR_COMPARISON_TYPE
 #define PNTR_COMPARISON_TYPE unsigned int
@@ -1122,6 +1137,7 @@ extern Lisp_Object Fget_buffer (), Fget_buffer_create (), Fset_buffer ();
 extern Lisp_Object Fbarf_if_buffer_read_only ();
 extern Lisp_Object Fcurrent_buffer (), Fswitch_to_buffer (), Fpop_to_buffer ();
 extern Lisp_Object Fother_buffer ();
+extern Lisp_Object Qoverlayp;
 extern struct buffer *all_buffers;
 
 /* defined in marker.c */